<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>isContainedIn</title>
</head>

<body>
    <script>
        const isContainedIn = (a, b) => {
            for (const v of new Set(a)) {
                if (
                    !b.some(e => e === v) ||
                    a.filter(e => e === v).length > b.filter(e => e === v).length
                ) {
                    return false;
                }
            }
            return true;
        };
        document.write(`isContainedIn([1, 4], [2, 4, 1])的结果是:${isContainedIn([1, 4], [2, 4, 1])}`)
    </script>
</body>

</html>